<?php

namespace app\admin\controller;

class sign extends Base
{
    //报名列表
    public function sign_list()
    {
        $sign = model('common/Sign')
            -> order([
                'status'=>'asc',
                'update_time'=>'desc'
            ])
            -> paginate(10);
        $data = [
            'sign' => $sign
        ];
        $this -> assign($data);
        return view();
    }

    //处理报名信息
    public function sign_status()
    {
        $sign = model('common/Sign') -> find(input('post.id'));
        $sign -> status = 1;
        $result = $sign -> save();
        if ($result){
            $this -> success('报名信息已处理！','admin/sign/sign_list');
        } else {
            $this -> error('处理失败！');
        }
    }

    //删除报名信息
    public function sign_del()
    {
        $sign = model('common/Sign') -> find(input('post.id'));
        $result = $sign -> delete();
        if ($result){
            $this -> success('报名信息已删除！','admin/sign/sign_list');
        } else {
            $this -> error('删除失败~！');
        }
    }


}
